//
//  receiveFirCirGetNews.m
//  tcpoctest
//
//  Created by gump on 5/8/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "receiveFirCirGetNews.h"

#import "FirendCircleDataSource.h"
#import "FirCirNewsMailDataSource.h"

#import "firendCircledb.h"
#import "FirCirMailNewsdb.h"

@implementation receiveFirCirGetNews

-(void)processreceive
{
    //返回 74char(1),10char(1),[用户名长度char(1), 用户名char(x),
    //动态ID字串长度char(1), 动态ID字串char(x)]*N 时间倒序
    [[DataControl shareControl].fircirDS RemovAllArr];
    
    while (logicsb.mrestLength > 0)
    {
        NSString *mail = [logicsb ReadUnencodeString];
        NSString *newsid = [logicsb ReadUnencodeString];
        
        [[DataControl shareControl].fircirDS AddFirCirArr:newsid];
        [[DataBaseCtrol shareControl].fircirdatabase insertFC:newsid];
        
        [[DataControl shareControl].fcnewsmailDS AddMail:mail withNewsID:newsid];
        [[DataBaseCtrol shareControl].fircirmailnewsdatabase insertNewMail:newsid
                                                                  withMail:mail];
    }
    
    [self ShowLog];
}

@end
